﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace Triples {
    public partial class FindAllSetsPage : PhoneApplicationPage {
        private readonly FindAllSetsController Controller;

        public FindAllSetsPage() {
            InitializeComponent();
            this.Controller = new FindAllSetsController();
            this.DataContext = Controller;

            //this.Controller.FoundSets.CollectionChanged += FoundSets_CollectionChanged;

            this.Controller.SetFound += new EventHandler(Controller_SetFound);
            this.Controller.GameComplete += new EventHandler(Controller_GameComplete);
            this.Controller.GameOver += new EventHandler(Controller_GameComplete);
        }


        void Controller_GameComplete(object sender, EventArgs e) {
            GameFinishedScoreBoard.Visibility = Visibility.Visible;
        }


        void Controller_SetFound(object sender, EventArgs e) {
            this.SetFoundStoryboard.Begin();
        }

        //void FoundSets_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) {

        //    Dispatcher.BeginInvoke(() => {
        //        FoundSetsScrollViewer.ScrollToHorizontalOffset(FoundSetsScrollViewer.ScrollableWidth);
        //    });
        //}

        private void GameFinishedButton_Click(object sender, RoutedEventArgs e) {
            NavigationService.GoBack();
        }
    }
}